package com.mzy.datepackage.M2022.Apr.six;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author mzy
 * @Date 2022/4/8 23:18
 * @Version 1.0
 */
public class Demo2 {
    public static void main(String[] args) {
        byte[] b = { 20 , 10 , 30 , 5 };

        writeContent("qeqe", "TEST.txt");
    }

    /**
     * 写内容
     *
     * @param content 内容
     * @param filePath 文件路径
     * @return
     */
    public static void writeContent(String content, String filePath) {
        File file = new File(filePath);
        try(
                FileOutputStream fileOutputStream = new FileOutputStream(file, true);
                Writer write = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8);
        ) {
            // 将内容写入文件
            write.write(content);
            write.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
